package obj;

import UI.control;


import java.util.concurrent.CopyOnWriteArrayList;

public class All {
    public CopyOnWriteArrayList<objs> flys=new CopyOnWriteArrayList<>();//飞行物品
    public CopyOnWriteArrayList<objs> drop_user=new CopyOnWriteArrayList<>();//掉落物
    public CopyOnWriteArrayList<objs> drop_enemy=new CopyOnWriteArrayList<>();//敌人凋落物
    public player user;
    public boolean Is_Start;
    public int scores;
    public All(){
        scores=0;
        Is_Start=true;
        this.SetUser(new player(100, control.heigth-100,10,10,"E:\\java\\month3-game\\resource\\img.png"));
        new Thread(new flush(this)).start();
        new Thread(new create(this)).start();
    }

    public void SetUser(player user){
        this.user=user;
    }
    public void AddPlayer(objs a){
        this.flys.add(a);
    }
    public void AddDrop(objs b,int type){
        //1是敌人发射的，2是自己发射的
        if(type==1)
            this.drop_enemy.add(b);
        else
            this.drop_user.add(b);
    }
    public void DelPlayer(objs one){
        this.flys.remove(one);
    }
    public void DeDrop(objs one,int type){
        //1是enemy
        if(type==1)
            this.drop_enemy.remove(one);
        else
            this.drop_user.remove(one);
    }
}
